/*
 *  Evaluator_Config.java
 * 
 *  Copyright (C) 2012-2013 Sylvain Lamprier, Tewfik Ziaidi, Lom Messan Hillah and Nicolas Baskiotis
 * 
 *  This file is part of CARE.
 * 
 *   CARE is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   CARE is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with CARE.  If not, see <http://www.gnu.org/licenses/>.
 */

package evaluation;

import java.util.ArrayList;
import traces.*;

import traces.Statement;

import miners.*;
import miners.KTail.KTail;
//import miners.temporalKTail.Lo_Temporal_KTail;
import miners.temporalKTail.TemporalKTail;
//import fr.lip6.meta.strategie.StatementComparaisonClassLevel;
//import fr.lip6.meta.behavioral.algoasma.*;

/**
 * 
 * Abstract class of configuration for Evaluator. <br>
 * Needs to be extended to define miners to evaluate, measures to use, sets of traces to consider and the strategy of statements equivalence to use.
 * <br>
 *  
 * The extended class needs to override a config() method defining the parameters of the evaluation.
 * <br>
 * This method should be structured like the following example :
 * <br> <br>
 * <em>
 * <pre>
 * - public void config(){			
 * -		//  Eval Measures //	
 * -		mes.add(new NbObservations());	
 * -		mes.add(new TailleTraces(1000));	
 * -		mes.add(new TailleLTS());	
 * -		mes.add(new Recall(false));	
 * -		mes.add(new Precision(1000,true));		
 * -		mes.add(new Recall(true,100,false)); 
 * -		mes.add(new Precision(100,false)); 
 * -		mes.add(new FMeasure(1,1000,true)); 
 * -		mes.add(new FMeasure(1,100,false)); 
 * -		
 * -		//  Algos  //
 * - 		LTSminer algo;
 * -		algo=new KTail(2);
 * -		algos.add(algo);
 * -		NoMergeMiner unlts=new NoMergeMiner();
 * -		algos.add(unlts);
 * -		
 * -		//  Traces Directories //
 * -		// ( for filtering : if traces_dirs is empty, the evaluation performs on every traces' directory of the program )  // 
 * -		traces_dirs.add("Uniform_traces");
 * -		
 * -		//  Dot Files Generation //
 * -		// (If you want that dot files representing the computed lts appear in the results repository, uncomment next line //
 * -		//genereDotFiles(true); 
 * - 		
 * - 		//  Statements Equivalence // 
 * -	 	// (the kind of stringifier used to compare statements) 
 * -	    Statement.strEquivalence=new Objects_MethodNameStatementStringifier();
 * -		
 * -		// Statements Stringifier // 
 * -		// (the kind of stringifier used to display statements) 
 * -		Statement.strStringifier=new Objects_MethodNameStatementStringifier();
 * - }
 * </pre>
 * </em>
 * <br>
 *  
 * @author Sylvain Lamprier
 */
public abstract class Evaluator_Config {
	/**
	 *  Evaluation measures to use
	 */
	protected ArrayList<EvalMeasure> mes;
	/**
	 * Miners to evaluate
	 */
	protected ArrayList<FSAminer> algos;
	
	/**
	 * Directories of traces to consider
	 */
	protected ArrayList<String> traces_dirs;
	
	/**
	 * Defines all evaluation settings
	 */
	public Evaluator_Config(){
		mes=new ArrayList<EvalMeasure>();
		algos=new ArrayList<FSAminer>();
		traces_dirs=new ArrayList<String>();
		Hyp.genereDot=false;
		config();
	}
	
	public void genereDotFiles(boolean g){
		Hyp.genereDot=true;
	}
	
	public ArrayList<EvalMeasure> getMeasures(){
		return(mes);
	}
	public ArrayList<FSAminer> getAlgos(){
		return(algos);
	}
	public ArrayList<String> getTracesDirs(){
		return(traces_dirs);
	}
	public abstract void config();
	
}

class Evaluator_Config1 extends Evaluator_Config{
	public void config(){
		
	   // ************** Statements Equivalence ********// 
		
       // ************** Eval Measures *****************//
		mes.add(new NbObservations());
		mes.add(new TailleTraces(1000));
		//mes.add(new EsperanceLongueurTracesUniformes());
		mes.add(new TailleFSA());
		mes.add(new Recall(false));
		/*mes.add(new Recall(true,1000,true));
		mes.add(new Precision(1000,true));		
		mes.add(new Recall(true,100,false));
		mes.add(new Precision(100,false));*/
		mes.add(new FMeasure(1,1000,true));
		mes.add(new FMeasure(1,100,false));
		mes.add(new TimeToProcess());
		mes.add(new MemUsed());
		
		// ********** Algos *************** //
		
		FSAminer algo;
		algo=new KTail(3);
		algos.add(algo);
		
		NoMergeMiner unlts=new NoMergeMiner();
		algos.add(unlts);
		
		// ************* Traces Directories *********************//
		// ( for filtering : if traces_dirs is empty, the evaluation performs on every traces' directory of the program )  // 
	
		//traces_dirs.add("Etat_traces_prandom=0,2_nbvars=20");
		traces_dirs.add("Unbiased_traces");
		
		// ************ Dot Files Generation *******************//
		// (If you want that dot files representing the computed lts appear in the results repository, uncomment next line //
		genereDotFiles(true);
		
		// ************** Statements Equivalence ********// 
		// (the kind of stringifier used to compare statements) 
		Statement.strEquivalence=new Objects_MethodNameStatementStringifier();
		
		// ************** Statements Stringifier ********// 
		// (the kind of stringifier used to display statements) 
		Statement.strStringifier=new Objects_MethodNameStatementStringifier();
		
	}
}


